<template>
  <div>
    <navComp :title="$route.meta.title" :back="$route.meta.back"></navComp>
    <div class="box">
      <img class="login_logo" src="../../assets/img/logo/orange.png" />
      <van-form @submit="register">
        <van-field
          v-model="info.nickname"
          type="nickname"
          name="nickname"
          label="用户名"
          placeholder="用户名"
          :rules="[{ required: true, message: '请填写密码' }]"
        />
        <van-field
          v-model="info.phone"
          name="phone"
          label="手机号"
          placeholder="手机号"
          :rules="[{ required: true, message: '请填写手机号' }]"
        />
        <van-field
          v-model="info.password"
          type="password"
          name="password"
          label="密码"
          placeholder="密码"
          :rules="[{ required: true, message: '请填写密码' }]"
        />
        <div style="margin: 16px">
          <van-button
            round
            block
            type="info"
            color="#FF6040"
            native-type="submit"
            >点击注册</van-button
          >
        </div>
      </van-form>
    </div>
  </div>
</template>

<script>
export default {
  name: "",
  components: {},
  data() {
    return {
      info: {
        nickname: "",
        phone: "",
        password: "",
      },
    };
  },
  created() {},
  mounted() {},
  methods: {
    register(info) {
      this.$api.Retister(info).then((res) => {
        console.log(res);
        this.$notify({ type: "success", message: "注册成功" });
        this.$router.push("/index")
      });
    },
  },
};
</script>
<style scoped lang="scss">
.box {
  margin-top: 40px;
  width: 100%;
  text-align: center;
}
</style>
